package com.hzsoft.tag;

import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.VariableInfo;

/**
 * <p>
 * 类描述：CollectionList的子标签实现形式
 * </p>
 * <p>
 * 创建人：黄利涛 <br>
 * 创建时间：2012-5-16 下午08:21:40
 * </p>
 * <p>
 * 修改人：无 <br>
 * 修改时间：无 <br>
 * 修改备注：无
 * </p>
 * 
 * @version 1.0
 */
public class ForEachInfo extends TagExtraInfo {
	final private static String VAR = "var";
	final private static String LIST = "list";
	final private static String CODE = "code";

	@Override
	public VariableInfo[] getVariableInfo(TagData data) {
		return new VariableInfo[] {
				new VariableInfo(data.getAttributeString(VAR),
						"java.lang.String", true, VariableInfo.AT_BEGIN),
				new VariableInfo(data.getAttributeString(CODE),
						"java.lang.String", true, VariableInfo.AT_BEGIN),
				new VariableInfo(data.getAttributeString(LIST),
						"java.lang.String", true, VariableInfo.AT_BEGIN) };
	}

	@Override
	public boolean isValid(TagData us) {
		if (Util.isSpecified(us, LIST)) {
			return true;
		} else {
			return false;
		}
	}
}
